import Mock from 'mockjs'
import { doCustomTimes } from '@/libs/util'
import orgData from './data/org-data'
import formData from './data/form-data'
import columns from './data/column-data'
import filters from './data/filter-data'
const Random = Mock.Random

export const getTableData = req => {
  const tableData = []

  doCustomTimes(50, () => {
    tableData.push(Mock.mock({
      'id': '@id',
      'name': '@name',
      'email': '@email',
      'birthday': '@date',
      'age': '@age',
      'city': '@city',
      'domain': '@domain'
    }))
  })
  return {
    'list': tableData,
    'total': 100
  }
}

export const getFormData = req => {
  return formData
}

export const getTableColumns = req => {
  return columns
}

export const getTableFilters = req => {
  return filters
}

export const getDragList = req => {
  const dragList = []

  doCustomTimes(5, () => {
    dragList.push(Mock.mock({
      'name': Random.csentence(10, 13),
      'id': Random.increment(10)
    }))
  })
  return dragList
}

export const uploadImage = req => {
  return Promise.resolve()
}

export const getOrgData = req => {
  return orgData
}
